#pragma once
#include <algorithm>
#include <cstdint>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

namespace common {
bool isHappy(int n);

bool canConstruct(std::string ransomNote, std::string magazine);
bool containsDuplicate(std::vector<int> &nums);
bool containsNearbyDuplicate(std::vector<int> &nums, int k);

int countSubstrings(std::string s);

int divide(int dividend, int divisor);
std::vector<int> findAnagrams(std::string s, std::string p);
int findKthLargest(std::vector<int> &nums, int k);
double findMedianSortedArrays(std::vector<int> &nums1, std::vector<int> &nums2);
int findKth(std::vector<int> &num1, std::vector<int> &num2, const int start1,
            const int end1, const int start2, const int end2, const int k);

std::vector<int> findNumsAppearOnce(std::vector<int> &array);

std::vector<std::string> generateParenthesis(int n);
std::vector<int> getLeastNumbers(std::vector<int> &arr, int k);

std::string intToRoman(int num);

int longestConsecutive(std::vector<int> &nums);

int lastRemaining(int n, int m);

int maximumProduct(std::vector<int> &nums);

int minSubArrayLen(int target, std::vector<int> &nums);

void nextPermutation(std::vector<int> &nums);
std::vector<int> productExceptSelf(std::vector<int> &nums);
std::vector<int> productExceptSelfOpt(std::vector<int> &nums);

uint32_t reverseBits(uint32_t n);
void rotate(std::vector<std::vector<int>> &matrix);
void rotateFlip(std::vector<std::vector<int>> &matrix);

int findMinIndex(int *num, int n);
int binarySearch(int *num, int start, int end, int target);
int search(std::vector<int> &nums, int target);
std::vector<int> searchRange(std::vector<int> &nums, int target);

void setZeroes(std::vector<std::vector<int>> &matrix);
void sortColors(std::vector<int> &nums);

} // namespace common
